import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-contaminated-data',
  templateUrl: './contaminated-data.component.html',
  styleUrls: ['./contaminated-data.component.scss']
})
export class ContaminatedDataComponent implements OnInit {

  public menuItem = null;
  public subSelectedIndex = 1;

  tabs = [
    {
      active: true,
      name: '地下水',
    },
    {
      active: false,
      name: '土壤'
    }
  ];
  menu = [
    {
      title: '土壤',
      children: [
        {
          title: '国标',
          value: 'tr-gb',
          select: true
        }, {
          title: '省标',
          value: 'tr-gbsb'
        }, {
          title: '风险评估',
          value: 'tr-fxpg'
        }
      ]
    }, {
      title: '地下水',
      children: [
        {
          title: '国标',
          value: 'dxs-gb'
        }, {
          title: '省标',
          value: 'dxs-sb'
        }, {
          title: '风险评估',
          value: 'dxs-fxpg'
        }
      ]
    }
  ]

  get showDXS() {
    return [
      'dxs-gb',
      'dxs-sb',
      'dxs-fxpg',
    ].find(i => i == this.menuItem?.value)
  }

  get showTR() {
    return [
      'tr-gb',
      'tr-sb',
      'tr-fxpg',
    ].find(i => i == this.menuItem?.value)
  }

  constructor() { }

  ngOnInit() {
  }

  menuClick(data) {
    this.menuItem = data;
    if (this.menuItem?.value == 'dxs-sb' || this.menuItem?.value == 'tr-sb') {
      this.subSelectedIndex = 0;
    } else {
      this.subSelectedIndex = 1;
    }
  }

}
